Skip to content

Allow EntityProperties use in replacementAttributes (templating)#8927

Merged
mandy-chessell merged 2 commits intoodpi:mainfrom
mandy-chessell:oak2025
Dec 15, 2025
Merged

Allow EntityProperties use in replacementAttributes (templating)#8927
mandy-chessell merged 2 commits intoodpi:mainfrom
mandy-chessell:oak2025

Conversation

@mandy-chessell
Copy link
Copy Markdown
Contributor

Description

By default, a templated create request will return an existing element if it matches the template element with the replacement attributes and placeholder properties replaced. If replacementProperties and placeholderProperties are both null, the createMetadataElementWithTemplate returns the template - since no attribute values have been changed. This is confusing so the request now throws InvalidParameterException if replacementProperties and placeholderProperties are both null. For example:

{
  "class": "GUIDResponse",
  "relatedHTTPCode": 400,
  "exceptionClassName": "org.odpi.openmetadata.frameworks.openmetadata.ffdc.InvalidParameterException",
  "exceptionSubclassName": "org.odpi.openmetadata.frameworks.openmetadata.ffdc.InvalidParameterException",
  "actionDescription": "createElementFromTemplate",
  "exceptionErrorMessage": "OPEN-METADATA-400-013 The objects passed on the replacement attributes and placeholder properties of the GovernanceDefinition operation are both null; the template has no new values to map",
  "exceptionErrorMessageId": "OPEN-METADATA-400-013",
  "exceptionErrorMessageParameters": [
    "GovernanceDefinition"
  ],
  "exceptionSystemAction": "The system is unable to process the request without some additional values.",
  "exceptionUserAction": "Correct the code in the caller to provide either replacement attributes and/or placeholder properties.",
  "exceptionProperties": {
    "parameterName": "replacementAttributes/placeholderProperties"
  }
}

In addition, replacementAttributes can now be expressed as bean properties as well as the generic ElementProperties. This makes it consistent with other properties in the API such as properties and parentRelationshipProperties. This means that a request like this is properly interepted

POST https://localhost:9443/servers/view-server/api/open-metadata/governance-officer/governance-definitions/from-template
Authorization: Bearer 
Content-Type: application/json

{
  "class" : "TemplateRequestBody",
  "templateGUID": "GovernanceDefinition-d38c5364-fe2a-4cce-a60f-cf62c6092042",
  "replacementProperties": {
    "class": "GovernanceDefinitionProperties",
    "qualifiedName" :  "New QName"
  }
}

Related Issue(s)

Removed initialStatus from NewElementRequestBody. This is the final change to remove the control of instanceStaces outside of the open metadata repositories.

Testing

Testing through the HTTP client

Release Notes & Documentation

Part of the current documentaiton update

Additional notes

None

@mandy-chessell mandy-chessell merged commit 6431375 into odpi:main Dec 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant